package com.nlgc365.designpattern.Chapter04_Pattern.Behavior.P05_State.State;

import com.nlgc365.designpattern.Chapter04_Pattern.Behavior.P05_State.Framework.State;

public class MarioSmall implements IStateTransfer {
    private MarioStateMachine marioStateMachine;

    public MarioSmall(MarioStateMachine marioStateMachine) {
        this.marioStateMachine = marioStateMachine;
    }

    /**
     * 函数: 获取当前状态
     */
    @Override
    public State getState() {
        return State.SMALL;
    }

    /**
     * 函数: 获得蘑菇
     */
    @Override
    public void obtainMushRoom() {
        marioStateMachine.setCurrentState(State.SUPER);
        marioStateMachine.setScore(marioStateMachine.getScore() + 100);
    }

    /**
     * 函数: 获得披风
     */
    @Override
    public void obtainCape() {
        marioStateMachine.setCurrentState(State.CAPE);
        marioStateMachine.setScore(marioStateMachine.getScore() + 200);
    }


    /**
     * 函数: 获得火焰
     */
    @Override
    public void obtainFireFlower() {
        marioStateMachine.setCurrentState(State.FIRE);
        marioStateMachine.setScore(marioStateMachine.getScore() + 300);
    }

    /**
     * 函数: 遇到怪物
     */
    @Override
    public void meetMonster() {
        // do noting..
    }


}
